﻿// Learn more about F# at http://fsharp.net


namespace NumericalFunctions
  open System
  open Microsoft.CSharp
  open System.Threading
  
  type FunctionValues() =
    static member public SplitIntervalWithPresicion (start:double) (stop:double) (accuracy:double) = 
        [| for i in start .. accuracy .. stop -> i |]

    static member public CreateFunctionValuesTable((f:Func<double*double,double>), startX, endX, startY, endY, accuracy )= 
        let xValuesMass = FunctionValues.SplitIntervalWithPresicion startX endX accuracy
        let yValuesMass = FunctionValues.SplitIntervalWithPresicion startY endY accuracy
        Array.map2 (fun x -> 
                    fun y -> (x,y,f.Invoke(x,y)) 
                 ) xValuesMass yValuesMass
    static member public CreateFunctionValuesTable((f:Func<double,double>), startX, endX, accuracy )= 
        let xValuesMass = FunctionValues.SplitIntervalWithPresicion startX endX accuracy
//        printfn "xValues created" |> ignore
        xValuesMass |>
        Array.map (fun x -> (x,f.Invoke(x)) 
                ) 
        
        